package com.ocom.payhandle.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ocom.common.entity.card.EntityXfWhiteInfo;
import com.ocom.common.entity.srvpaccess.XfWhiteInfo;
import com.ocom.common.vo.pyhandle.GetComWhiteListVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface IDaoXfWhiteInfo extends BaseMapper<XfWhiteInfo> {


    @Select({"<script>",
            "SELECT " +
                    " x.id, " +
                    " x.p_id, " +
                    " x.state, " +
                    " p.status, " +
                    " p.dept_id, " +
                    " p.p_name, " +
                    " p.p_code, " +
                    " p.p_sex, " +
                    " p.p_born, " +
                    " d.dept_type, " +
                    " p.p_photo_url2," +
                    " p.p_photo_url" +
                    " FROM " +
                    " xf_white_info x " +
                    " LEFT JOIN personnel_info p ON p.p_id = x.p_id " +
                    " LEFT JOIN dept_info d ON p.dept_id = d.dept_id " +
                    " AND p.com_id = #{comId} " +
                    " WHERE " +
                    " x.com_id = #{comId} " +
                    " AND x.id > #{personVer} " +
                    " <when test=\"personVer==0 \" >  " +
                    " AND x.state = 0 " +
                    " </when>" +
                    " ORDER BY " +
                    " x.id " +
                    " LIMIT #{listLimit}" +
                    "</script>"}
    )
    public List<GetComWhiteListVo> getComWhiteList(@Param("comId") Long comId, @Param("personVer") Integer personVer, @Param("listLimit") Integer listLimit);
}
